package com.simtop.controller;


import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * @ClassName: TimingController 定时任务调度 使用tool util 可能会出现线程睡眠 多并发的问题
 * @Description TODO
 * @Author liuzhaobo
 * @Date 2022/9/1 0001 13:27
 * @Version 1.0
 **/
/*@RestController
@CrossOrigin
@Component
@EnableScheduling*/
public class TimingController {

/*    @Bean
    public TaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
        taskScheduler.setPoolSize(64);
        return taskScheduler;
    }*/

    //    @Scheduled(cron = "*/2 * * * * ?")
    public void run() {
        System.out.println("开始");

        System.out.println("结束");
    }


    public void run2() {
        System.out.println("开始2");

        System.out.println("结束2");
    }

}